DXL else if .vs elseif

I accidentally discovered that DXL (9.5.2.1) accepts both "elseif" and "else if" without error.  I cannot ascertain if this inconsistency has caused a situation where erroneous results can occur.  I am concerned with the "else if" format, does anybody have any evidence where using "else if" will present a situation where the code will provide a false result?

 

Thanks.


MGDMGD - Tue Feb 07 18:02:23 EST 2017

Re: DXL else if .vs elseif
Mike.Scharnow - Wed Feb 08 02:26:37 EST 2017

there is no difference.

looking at other languages, Javascript uses the "else if" syntax, perl uses "elsif", php uses "elseif" and "else if".

In any case, your block structure is like this

if (cond1) {
    stmt1
} else[ ]if (cond2) {
    stmt2
} else {
    stmt_else
}

In the case of "else if", you could also imagine the code as being

if (cond1) {
    stmt1
} else {
    if (cond2) {
        stmt2
    } else {
        if(cond3) {
            stmt3
        } else {
            stmt_else
        }
    }
}

I see is no disambiguation where the final else would be evaluated in a wrong context. So, don't worry...